package face.pay.web.quota;

import face.pay.common.quota.service.IQuotaInfoService;
import face.pay.entity.AgencyQuotaApply;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.ResultMessage;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: zkj
 * @Date: 2019/7/18 09:20
 * @Description:
 */
@Controller
@RequestMapping("/agency_quota")
public class QuotaInfoController {

    @Autowired
    private IQuotaInfoService iAgencyQuotaService;


    @RequestMapping("/info")
    public String info(){

        return "quota/info";
    }


    /**
     * 查询自己的 名额
     * @param loginUser
     * @param pageParam
     * @return
     */

    @RequestMapping("/queryData")
    @ResponseBody
    public PageData queryData(@CurrentUser UserInfo loginUser, PageParam pageParam){


        return  this.iAgencyQuotaService.queryUserData(loginUser,pageParam);
    }


    /**
     *
     * @param loginUser
     * @param agencyQuotaApply
     * @return
     */
    @RequestMapping("/buyQuota")
    @ResponseBody
    public ResultMessage buyQuota(@CurrentUser UserInfo loginUser, AgencyQuotaApply agencyQuotaApply){

        return  this.iAgencyQuotaService.startApply(agencyQuotaApply,loginUser);
    }





}
